<template>
	<view>
		<view class="mainpadding2">
			<view class="flexcenter" v-if="!list.data.length">
				<view class="placeholderimage" style="margin-top: 100rpx;"></view>
			</view>
			<view class="mainpadding_top ffffff radius"  v-for="item in list.data" :key="item.id" @click="dati(item)">
				<template>
					<view class="flexbetween pdl">
						<view class="flexleft" style="align-items: flex-end;">
							<view class="lan_text bold" style="font-size: 40rpx;">+{{item.payout}}</view>
							<view class="xiaohei" style="padding-bottom: 10rpx;">points</view>
						</view>
						<view class="" style="border-left: 1rpx solid rgba(0, 0, 0, .03);">
							<u-rate :value="item.statistics_rating_avg" active-color="#ffa126" inactive-color="#b2b2b2" readonly></u-rate>
							<view class="xiaohei margin_top1">{{item.statistics_rating_count}}等级</view>
						</view>
					</view>
					<view class="flexbetween margin_top">
						<view class="flexleft">
							<u-icon name="clock" size="16" color="#333"></u-icon>
							<view class="hei_text bold titletext">~{{item.loi}}分钟</view>
							<u-icon name="checkbox-mark" size="16" color="#06b025"></u-icon>
						</view>
						<u-icon name="arrow-right" size="16" color="#999"></u-icon>
					</view>
<!-- 					<view class="hei_text bold titletext">{{info.title}}</view>
					<view class="pdl">
						<view class="flexleft margin_top">
							<image :src="info.image_text" class="listleftimg radius" mode=""></image>
							<view class="flexcolumnbet margin_left2" style="height: 160rpx;width: 100%;">
								<view class="flexbetween" style="width: 100%;">
									<view class="hui_text bold main_size">参与人数{{info.join_num}}</view>
								</view>
								<view class="hui_text bold main_size">推荐答题时间：{{info.rec_dtsj}}</view>
								<view class="flexbetween" style="width: 100%;">
									<view class="hui_text bold main_size">奖励积分:{{info.score}}分</view>
									<view class="flexleft" @click.stop="yjdjshow=true">
										<view class="hui_text bold main_size">冻结比例:{{info.dj_rate}}%</view>
										<u-icon name="question-circle" size="16" color="#999"></u-icon>
									</view>
								</view>
							</view>
						</view>
						<view class="flexbetween margin_top">
							<view class="lan_text bold main_size">成功人数:{{info.success_num}}</view>
							<view class="flexleft ">
								<view class="tuijian margin_right" v-show="info.gyj_status==1">高佣金</view>
								<view class="huobao margin_right" v-show="info.hot_status==1">火爆</view>
								<view class="remen" v-show="info.jd_status==1">简单</view>
							</view>
						</view>
					</view>
					<view class="flexright margin_top">
						<view class="listbtnlan flexcenter margin_left">
							<u-icon name="file-text" size="16" color="#3478f5"></u-icon>
							<view class="margin_left1">答题</view>
						</view>
					</view> -->
				</template>
			
			</view>
		</view>
	
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page: 1,
				limit: 12,
				list: {
					data: []
				},
				info:{
					
				}
			}
		},
		onLoad(options) {
			let data=JSON.parse(decodeURIComponent(options.data));
			console.log(data.url2,'data.url2')
			this.info=data.item;
			this.getData(data.url2);
		},
		methods: {
			dati(item){
				let reg1 = new RegExp("amp;", "g"); // 加'g'，删除字符串里所有的"amp"
				let url2 = item.href_new.replace(reg1, "");
				let data = {
					url2
				}
				plus.runtime.openURL(url2)
				return false
				// 之前逻辑需要判断（下面是之前逻辑），现在改成所有都是跳转浏览器了
				// uni.navigateTo({
				// 	url: "/pages/webview/webview?msg=" + encodeURIComponent(JSON.stringify(data)) 
				// })
			},
			getData:function(url){
				console.log(url,22);
				let _this=this;
				uni.request({
					url: url,
					// url: 'https://live-api.cpx-research.com/api/get-surveys.php?app_id=20479&secure_hash=1gUqker3JoFGOxRf6UH8xcSfOwbUp1jB&output_method=api&limit=100&subid_2=app&ext_user_id=533515&ip_user=39.165.245.66',
					header: {
						'content-type': 'application/json',
					},
					method: 'GET', //'GET','POST'
					dataType: 'json',
					success: (res) => {
						console.log(res);
						if(res['data']['status']=='success'){
							_this.list.data=res.data.surveys;
						}else{
							uni.showToast({
								title: "没题目",
							});
							setTimeout(()=>{
								uni.navigateBack(-1)
							},1000)
						}
						
					},
					fail: (res) => {
						console.log(res,33);
						uni.showToast({
							title: res.errMsg,
						});
						setTimeout(()=>{
							uni.navigateBack(-1)
						},1000)
					}
				})
			}
		}
	}
</script>

<style>

</style>
